<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="clickName">随机点名</button>
    <h3 id="font">null</h3>
    <script>
        //获取节点
        const btn=document.querySelector('.clickName');
        const text=document.querySelector('#font');
        //准备数组：名字
        let arr=['a','b','c','d','e'];
        btn.addEventListener('click',function(){
            let index=Math.floor(Math.random()*arr.length)
            text.innerHTML=arr[index];
        },false)
    </script>
</body>
</html>